/*
 * Copyright (c) 2001, 2002 Boris Pruessmann and others.
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Common Public License v0.5
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v05.html
 * 
 * Contributors:
 *    Boris Pruessmann - Initial implementation.
 */
package net.sourceforge.perforce.api.internal;

import java.util.Map;

/**
  * Wrapper class for Perforce API SpecData class.
  * 
  * @version $Revision: 41 $
  * @author  <a href="mailto:bpruessmann@users.sourceforge.net>Boris Pruessmann</a>
  */
public final class SpecData
{
	// --------------------------------------------------------------------------- Private Variables
	
	/** Used to store the native reference.
	  * <br>DON'T TOUCH THE CONTENT OF THIS VARIABLE 
	  */
	private int _nativeHandle;

	// ------------------------------------------------------------------------- Public Constructors

	/** Constructor for SpecData. */
	public SpecData()
	{
		construct();
	}

	// ------------------------------------------------------------------------------ Public Methods
	
	/** @see Object#finalize() */
	public void finalize() 
		throws Throwable
	{
		// TODO:
		super.finalize();
		destruct();
	}

	/** Returns the SpecData in form of a Map.
	  * 
	  * @return SpecData as Map.
	  */
	public native Map getSpecDataMap();
	
	/** Returns the value associated with the given key.
	  *
	  * @param key used for lookup.
	  * @return the associated value.
	  */
	public native String get(String key);
	
	/** Replaces the value for the given key.
	  * 
	  * @param key the key.
	  * @param value the value.
	  */
	public native void replace(String key, String value);

	// ----------------------------------------------------------------------------- Private Methods

	/** Called by the constructor to initialize the native side
	  * of this class.
	  */
	private native void construct();
	
	/** Called by finalize() to destroy the native side of this
	  * class.
	  */
	private native void destruct();
}
